package com.hxg.server.converter;


import org.springframework.core.convert.converter.Converter;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * 日期转换
 * @author Hexg
 * @date 2022/3/3 19:54
 */
@Component
public class DataConverter implements Converter<String, LocalDate> {


    @Override
    public LocalDate convert(String s) {
        try{
            return LocalDate.parse(s, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        }catch (Exception e){
            e.getStackTrace();
        }
        return null;

    }
}
